Skip to content

fix(mission): size backend-started forks and log launch widths - #372

Merged
yicheng47 merged 1 commit into
mainfrom
fix/367-371-launch-width-and-instrumentation
Jul 29, 2026
Merged

fix(mission): size backend-started forks and log launch widths#372
yicheng47 merged 1 commit into
mainfrom
fix/367-371-launch-width-and-instrumentation

Conversation

@yicheng47

Copy link
Copy Markdown
Owner

Two determined fixes plus diagnostic logging for the launch-resume width thread (#366).

#367 — MCP-started missions fork slots at 80×24, first slot visit purges scrollback

  • AppState.mission_grid_hint caches the frontend's most recent known-good mission pane grid, pushed via the new mission_grid_hint_set command: once per launch after the window-geometry settle gate (unconditionally — not gated on resume-on-launch), on every workspace measurement (reset / resume-all), and on every real slot-terminal geometry push (new onSizePushed callback threaded through SlotPtyPane).
  • mission_start_impl_with_size and mission_reset_impl consume the hint when the caller passes no size (the MCP reset tool had the identical hardcoded-None defect), falling to DEFAULT_PTY_SIZE only when no hint was ever recorded. The cols-gate purge itself is untouched — it remains correct for genuinely stale-width bytes (impl 0020 / feat: headless terminal model for durable session scrollback #306).
  • Tests: mission_fork_size resolver triple, register-level default, and two seam tests driving resolver output through register_mission_session + complete_mission_session_spawn asserting the actually-forked SpawnSpec.initial_size.

#371shellContentBox falls back to full-window width and can read the wrong <main>

  • Returns null on failed measurement (never window.innerWidth, which includes the sidebar); null propagates through missionPaneAreaBox / chatPaneAreaBox / estimateMissionTerminalGrid and launchDimsFor so the persisted rung takes over.
  • Scoped to main[data-shell-main] (stamped on AppShell's <main>), immune to SettingsPage's second <main> under the takeover.
  • Tests: missing/zero-rect main abstention, decoy-<main> selection, null propagation.

#366 — instrumentation (mechanism still undetermined; one production repro should answer it)

All info-level so it reaches the packaged build's rotating file log:

  • Backend: one line per fork after successful runtime.spawn (resume / resume-on-launch / mission slots) with session, runtime, cols×rows, and size source; cols-gate purge lines with old→new cols.
  • Frontend: minimal frontend_log command routes [launch-dims] lines into the same file — settle outcome + elapsed ms per launch, per-resumed-session rung detail (main rect, rail/panel widths, pane share, resulting grid), and first-fit for launch-resumed sessions only (launchResumeTrace mark/consume).

Docs

Duplicate impl number resolved: 0036-launch-resume-fork-width.md0038 (git mv), all in-repo references updated; 0036-trae-runtime.md keeps its number.

Verification

cargo test --workspace (556 across suites), cargo fmt --check, cargo clippy --workspace, tsc --noEmit, eslint, vitest 248/248. Peer-reviewed working-tree diff — clean review, plus dev-build smoke: settle/hint/rung/fork/first-fit/purge lines all present and cross-correlated in runner.log.

Closes #367. Closes #371. Refs #366.

🤖 Generated with Claude Code

Two determined fixes plus diagnostics for the launch-resume width thread:

- #367: cache the frontend's mission pane grid in AppState
  (mission_grid_hint_set), pushed after the launch settle gate
  (unconditionally), from workspace measurements, and from every real
  slot-terminal geometry push. MCP mission_start/mission_reset consume
  it when unsized, so slots no longer fork at 80x24 and lose their
  scrollback to the first slot-tab visit's cols-gate purge.
- #371: shellContentBox returns null on failed measurement (no
  window.innerWidth fallback) and targets AppShell's main via
  data-shell-main, immune to SettingsPage's second <main>. Null
  propagates so launchDimsFor falls to the persisted rung.
- #366 diagnostics (info level, reaches the packaged rotating log):
  per-fork lines after successful runtime.spawn (resume paths + mission
  slots, with size source), cols-gate purge lines with old->new cols,
  and [launch-dims] frontend lines routed through a new frontend_log
  command — settle outcome, per-resumed-session rung detail, and
  first-fit for launch-resumed sessions only (launchResumeTrace).
- docs: renumber duplicate impl 0036-launch-resume-fork-width to 0038
  and update every in-repo reference.

Closes #367. Closes #371. Refs #366.

Checks: cargo test --workspace, cargo fmt --check, tsc --noEmit,
eslint, vitest 248/248; peer-reviewed working-tree diff (clean).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant